package com.ycrlkj.android.modulescore.main.activity;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;

import com.alibaba.android.arouter.facade.annotation.Autowired;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.lxj.xpopup.interfaces.OnConfirmListener;
import com.ycrlkj.android.modulescore.main.databinding.ActivityXxReportDetailBinding;
import com.ycrlkj.android.modulespublic.common.constant.RoutePath;
import com.ycrlkj.android.modulespublic.common.utils.xpopup.XPopupUtil;
import com.ycrlkj.android.modulespublic.common.widget.titlebar.MTitleBar;

import dagger.hilt.android.AndroidEntryPoint;

@AndroidEntryPoint
@Route(path = RoutePath.PAGE_REPORT_DETAIL)
public class XxReportDetailActivity extends AppCompatActivity {

    @Autowired
    String id;

    private ActivityXxReportDetailBinding binding;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ARouter.getInstance().inject(this);

        binding = ActivityXxReportDetailBinding.inflate(getLayoutInflater());

        if (id == null && id.length() != 19) {
            XPopupUtil.showAlert(this, "未找到报告信息, 关闭页面", new OnConfirmListener() {
                @Override
                public void onConfirm() {
                    XxReportDetailActivity.this.finish();
                }
            });
        }

        initTitleBar();

        setContentView(binding.getRoot());
    }

    public void initTitleBar() {
        MTitleBar mTitleBar = binding.mTitleBar;
        mTitleBar.setBtnEvents(new MTitleBar.BtnEvents() {
            @Override
            public void setBtnLeftOnClickListener() {
                XxReportDetailActivity.this.finish();
            }

            @Override
            public void setBtnRightOnClickListener() {
                //隐藏按钮, 无事件
            }
        });
    }


}